/**
 * Created by fdg282 on 2017/11/2.
 */
function ajaxShow() {
    var paging = 1;//页码数
    // dropload函数接口设置
     $('.scroll_news_div').dropload({
        scrollArea: window,
        // 下拉刷新模块显示内容
        //  上拉加载更多 回调函数
        loadDownFn: function (me) {
            //var url = requeryUrl;

            $.ajax({
                type: 'GET',
                url: jsonUrl+'?page='+paging,
                dataType: 'json',
                success: function (result) {
                    // 选择需要显示的数据 拼接 DOM
                    if(result.length==0){
                        me.lock();
                        me.noData();
                        me.resetload();
                    }else {
                        var html = '';
                        for (var i = 0; i < result.length; i++) {
                            html +='<li>';
                            html +='<a href="'+linkUrl+'/news_id/'+result[i].id+'">';
                            html +='<img src="'+imgUrl+result[i].article_pic+'" alt="'+result[i].article_title+'" >';
                            html +='<div class="news-ul-text">';
                            if(result[i].articleIdentification){
                                html +='<p class="news-ul-t-p01">'+result[i].articleIdentification.name+'</p>';
                            }else{
                                html +='<p class="news-ul-t-p01"> </p>';
                            }
                            html +='<p class="news-ul-t-p02">'+result[i].article_title+'</p>';
                            html +='<p class="news-ul-t-p03">'+result[i].summary+'</p>';
                            html +='</div>';
                            html +='</a>';
                            html +='</li>';
                        }

                        setTimeout(function () {
                            $('.scroll_news').append(html);
                            me.resetload();
                        }, 1000);
                        me.resetload();
                    }
                },
                error: function (xhr, type) {
                    console.log('加载出错了!');
                    me.resetload();
                }
            });

            paging++; // 每次请求，页码加1
        },
        threshold:200,
         domDown: {
             domClass: 'dropload-down',
             // 滑动到底部显示内容
             domRefresh: '<div class="dropload-refresh"></div>',
             // 内容加载过程中显示内容
             domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
             // 没有更多内容-显示提示
             domNoData: '<div class="dropload-noData">暂无数据</div>'
         }
    });
}
ajaxShow();
// mod FDG416 2018/04/17 ID584 【商城需求】文章列表页展示调整 start
//判断是否IE/火狐浏览器  
_isIE();
function _isIE() {  
    var news_banner_t_p02 = $('.news-banner-t-p02').text().length;
    var news_banner_t_p03 = $('.news-banner-t-p03').text().length;
    var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串  
    var isIE = userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1; 
    var isH = userAgent.indexOf('Firefox') > -1; 
    $('.scroll_news').children().each(function(){
        var news_ul_t_p02 = $(this).find('.news-ul-t-p02').text().length;
        var news_ul_t_p03 = $(this).find('.news-ul-t-p03').text().length;
        if(isIE || isH) { 
            if(news_banner_t_p02 > 52) {
                $('.news-banner-t-p02').text($('.news-banner-t-p02').text().slice(0,52)+'...'); 
            }
            if(news_banner_t_p03 > 140) {
                $('.news-banner-t-p03').text($('.news-banner-t-p03').text().slice(0,140)+'...'); 
            }
            if(news_ul_t_p02 > 25) {
                $(this).find('.news-ul-t-p02').text($(this).find('.news-ul-t-p02').text().slice(0,25)+'...'); 
            }
            if(news_ul_t_p03 > 65) {
                $(this).find('.news-ul-t-p03').text($(this).find('.news-ul-t-p03').text().slice(0,65)+'...'); 
            }
        }  
    })
} 
// mod FDG416 2018/04/17 ID584 【商城需求】文章列表页展示调整 end